from sklearn.decomposition import PCA

def pca():
    """
    主成分分析进行特征降维
    :return:
    """
    pca = PCA(n_components=0.9)
    """
    [[ 1.28620952e-15  3.82970843e+00]
    [ 5.74456265e+00 -1.91485422e+00]
    [-5.74456265e+00 -1.91485422e+00]]
    """
    data = pca.fit_transform([[2,8,4,5],[6,3,0,8],[5,4,9,1]])
    print(data)

if __name__ =='__main__':
    pca()